extends PanelContainer

@onready var card_container: PanelContainer = $"."
@onready var texture_rect: TextureRect = %TextureRect

var card_data: Dictionary

func display(card: Dictionary) -> void:
	card_data = card
	texture_rect.texture = load(card.card_icon)

func set_preview() -> void:
	Game.menu_ui.card_inventory.card.show()
	#Game.menu_ui.card_inventory.card.
	
	Game.menu_ui.card_inventory.card.card_name.text = card_data.card_name
	Game.menu_ui.card_inventory.card.card_effect_description.text = card_data.card_effect_description
	Game.menu_ui.card_inventory.card.card_description.text = card_data.card_description
	Game.menu_ui.card_inventory.card.card_icon.texture = load(card_data.card_icon)
	
	if card_data.card_quality == "normal":
		Game.menu_ui.card_inventory.card.quality_color.color = "#ffffff"
	elif card_data.card_quality == "rare":
		Game.menu_ui.card_inventory.card.quality_color.color = "#65ff4a"
	elif card_data.card_quality == "legend":
		Game.menu_ui.card_inventory.card.quality_color.color = "#ffff00"

func _on_mouse_entered() -> void:
	card_container.scale = Vector2(1.01, 1.01)
	set_preview()

func _on_mouse_exited() -> void:
	card_container.scale = Vector2(1.0, 1.0)
